package base.ioctest;

import java.lang.reflect.Field;

public class Test {
	static {
		try {
			
			Class<?> cls = Class.forName("base.ioctest.AService");
			AService a = (AService)cls.newInstance();
			Class<?> cls2 = Class.forName("base.ioctest.AController");
			AController aController = (AController)cls2.newInstance();
			Field field = cls2.getDeclaredField("aService");
			field.setAccessible(true);
			field.set(aController, a);
			aController.sayA();
			
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NoSuchFieldException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		System.out.println("over");
	}
}
